<template>
  <div class="login">
    <div class="login-wrap">
      <div class="login-wrap-left">
        <p class="login-left-title">小班企业管理</p>
      </div>
      <div class="login-wrap-right">
        <h1>登录</h1>
        <el-form :inline="true" :model="form" status-icon class="demo-form-inline" ref="form">
          <el-form-item>
            <el-input v-model="form.username"  style="width: 280px" placeholder="用户名" maxlength="20"   prefix-icon="el-icon-user"/>
          </el-form-item>
          <br>
          <br>
          <el-form-item>
            <el-input v-model="form.password" type="password" style="width: 280px" placeholder="密码" maxlength="20" prefix-icon="el-icon-lock" />
          </el-form-item>
          <br>
          <br>
          <el-form-item>
            <el-input v-model="form.captchaCode"  style="width: 160px" placeholder="验证码" prefix-icon="el-icon-first-aid-kit"  />
          </el-form-item>
          <el-form-item>
            <el-image style="width: 110px; height: 36px ;cursor: pointer;"  @click.native="refreshCaptcha" class="login-wrap-right-captchaPic" :src="captchaPic" fit="contain" />
          </el-form-item>
          <br>
          <br/>
          <el-form-item>
            <el-button type="primary" style="width: 240px"  @click="onSubmit" :loading="ConfirmLoading">登录</el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script>

export default {
  name: 'login',
  data() {
    return {
      form:{
        username:'',
        password:'',
        captchaCode:'',
        uuid:'',
      },
      captchaPic: '',
      ConfirmLoading: false
    };
  },
  methods:{
    onSubmit(){
      this.ConfirmLoading = true;
    },
    refreshCaptcha(){
      this.$api.getCaptcha().then(res =>{
        console.log(res.data.captchaPic)
        console.log(res.data.uuid)
        this.captchaPic = res.data.captchaPic;
        this.form.uuid = res.data.uuid;
      })
    }
  }
};
</script>

<style scoped>
.login {
  width: 100vw;
  height: 100vh;
  background: rgb(1, 158, 196);
  display: flex;
  justify-content: center;
  align-items: center;
}

.login-wrap {
  display: flex;
  top: 30%;
  /*justify-content: center; !* 水平居中 *!*/
  width: 1000px; /* 固定宽度 */
  box-shadow: -4px 5px 10px rgba(0, 0, 0, 0.4);
  border-radius: 10px;
}

.login-wrap-left {
  /*float: left;*/
  height: 500px;
  width: 50%;
  background-color: rgb(23, 179, 163);
  color: white;
  align-content: center;
}

.login-wrap-right {
  /*float: right;*/
  height: 500px;
  width: 50%;
  background-color: #fff;
  text-align: center;
  align-content: center;
}

.login-left-title {
  /*text-align: center;*/
  color: #fff;
  font-weight: 200;
  letter-spacing: 2px;
  font-size: 36px;
  text-align: center;
}

.login-wrap-right-captchaPic{
  /*padding: 2px;*/
  border: #781a1a 1px solid;
  border-radius: 4px;
}
</style>
